package com.jxud.utils;

//个线程上下文持有类：
public class DesensitizationContextHolder {
    private static final ThreadLocal<Boolean> DESENSITIZATION_DISABLED = ThreadLocal.withInitial(() -> false);

    public static void disableDesensitization() {
        DESENSITIZATION_DISABLED.set(true);
    }

    public static void enableDesensitization() {
        DESENSITIZATION_DISABLED.set(false);
    }

    public static boolean isDesensitizationDisabled() {
        return DESENSITIZATION_DISABLED.get();
    }

    public static void clear() {
        DESENSITIZATION_DISABLED.remove();
    }
}
